import java.util.Scanner;

public class TwoNumber {
    //返回参数的二进制中1的个数


    //方法3
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        while(n != 0){
            n = n & (n - 1);
            count++;
        }
        System.out.println(count);
    }


    //方法2
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        while(n != 0){
            if((n & 1) != 0){
                count++;
            }
            //必须为无符号右移，这样才能解决负数死循环的问题
            n = n >>> 1;//每&一次1之后，向右移动一位，当右移后的十进制数字为0时，while停止循环
        }
        System.out.println(count);
    }


    //方法1
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        for (int i = 0; i < 32; i++) {
            if( ((n >>> i) & 1) != 0){
                count++ ;
            }
        }
        System.out.println(count);
    }
}
